﻿using UnityEngine;
using System.Collections;

public static class UITool{
    public static T MyGetComponent<T>(this Transform t, string name) {
        T typeT=default(T);
        try {
           typeT = t.Find(name).GetComponent<T>();
        } catch (System.Exception) {
            Debug.LogError(t.name + " not Find name is " + name + " GameObject,Please check / Enter for \\ ");
        }
   
        return typeT;
    }
    public static T MyGetComponent<T>(this GameObject t, string name) {
        T typeT = default(T);

        try {
            typeT = t.transform.Find(name).GetComponent<T>();
        } catch (System.Exception) {
            Debug.LogError(t.name + " not Find name is " + name + " GameObject,Please check / Enter for \\ ");
        }

        return typeT;
    }
}
